package GossipDemo;

import com.gossip.StartupSettings;

import java.io.File;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;

import org.json.JSONException;

import com.gossip.GossipService;
import com.gossip.GossipSettings;
import com.gossip.LogLevel;
import com.gossip.GossipMember;


public class Demo extends Thread{

	public static void main(String[] args) {
		new Demo();
	}
	
	public Demo() {
		start();
	}
	
	public void  run()
	{
		try{
			StartupSettings settings = StartupSettings.fromJSONFile(new File("me.txt"));
			String myIpAddress = InetAddress.getLocalHost().getHostAddress();
			GossipService gossipService = new GossipService(myIpAddress, LogLevel.DEBUG, settings);
			gossipService.start();
			sleep(1000);
		}
		catch (UnknownHostException e) {
			e.printStackTrace();
		}
		catch (InterruptedException e) {
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}

